package com.example.vip31.resource;

import android.graphics.Bitmap;

/**
 * *******************************************************
 * Author: chinadragon
 * Time: 10/7/21 11:27 AM
 * Name:
 * Overview:
 * Usage:
 * *******************************************************
 */
public class Value {
    //url = "https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png";
    private String key;//Lrucache 无法识别特殊字符串，通过算法将路径转化为key
    private Bitmap mBitmap;
    private ValueCallBack mValueCallBack;

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public Bitmap getBitmap() {
        return mBitmap;
    }

    public void setBitmap(Bitmap bitmap) {
        mBitmap = bitmap;
    }

    public ValueCallBack getValueCallBack() {
        return mValueCallBack;
    }

    public void setValueCallBack(ValueCallBack valueCallBack) {
        mValueCallBack = valueCallBack;
    }

    /**
     * 回收 回调 释放 value 本身，通过活动缓存把当前value移动到LRU内存缓存里
     */
    public void recycle() {
        if (mValueCallBack != null) {
            mValueCallBack.valueNoUserListener(key,this);//活动缓存管理监听（value不再使用了）
        }
    }
}
